/*
 * Jabberd2-json-libs-java  
 * Copyright (C) 2010 Antti Leppä / Foyt
 * http://www.foyt.fi
 * 
 * License: 
 * 
 * Licensed under GNU General Public License Version 3 (GPL) 
 * http://www.gnu.org/licenses/gpl.html
 */

package fi.foyt.jabberd2json;

/**
 * Defines object set type
 */
public enum ObjectSetType {
  
  ACTIVE              ("active"),
  LOGOUT              ("logout"),
  ROSTERITEMS         ("roster-items"),
  ROSTERGROUPS        ("roster-groups"),
  VCARD               ("vcard"),
  MESSAGEQUEUE        ("queue"),
  PRIVATESTORAGE      ("private"),
  MOTDMESSAGE         ("motd-message"),
  MOTDTIMES           ("motd-times"),
  DISCOVERYITEMS      ("disco-items"),
  DEFAULTPRIVACYLIST  ("privacy-default"),
  PRIVACYITEMS        ("privacy-items"),
  VACATIONSETTINGS    ("vacation-settings"),
  STATUS              ("status");
  
  private ObjectSetType(String name) {
    this.name = name;
  }
  
  /**
   * Returns Object set's internal name 
   * 
   * @return Object set's internal name
   */
  public String getName() {
    return name;
  }
  
  /**
   * Finds object set type by internal name
   * 
   * @param name internal name of object set
   * @return Object set type
   */
  public static ObjectSetType getByName(String name) {
    for (ObjectSetType objectSetType : values()) {
      if (objectSetType.getName().equals(name))
        return objectSetType;
    }
    
    return null;
  }
  
  private String name;
}
